package org.kjtc.mapper;

import org.apache.ibatis.annotations.*;
import org.kjtc.entity.UserInfo;
import org.springframework.boot.autoconfigure.security.SecurityProperties;

import java.util.List;

/**
 * Created by Administrator on 2017/12/11 0011.
 */
@Mapper
public interface UserMapper {

    @Select("select UserID,UserName from userinfo")
    public List<UserInfo> getAllUsers();

    @Delete("delete from userinfo where UserID = #{UserID}")
    int updateUserInfo(UserInfo userInfo);

    @Insert("insert into userinfo (" +
            "UserID," +
            "UserName," +
            "Enabled," +
            "CreateUser," +
            "CreateDTTM," +
            "UpdateUser," +
            "UpdateDTTM" +
            ") values (" +
            "#{UserID}," +
            "#{UserName}," +
            "'1'," +
            "#{CreateUser}," +
            "SYSDATE()," +
            "#{UpdateUser}," +
            "SYSDATE()" +
            ")")
    int addUserInfo(UserInfo userInfo);

    @Select("select count(*) from userinfo where userID=ifnull(#{UserID},0)")
    int getAllUserID(UserInfo userInfo);


}
